home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 32 / Mac Magazin and MacEasy Magazine CD - Issue 32.iso / Grafik & Text / OzTeX3.0 / BibTeX / BibTeX inputs / acm.bst < prev    next >
Text File  |  1996-02-11  |  19KB  |  1,135 lines

  1. % ACM Transactions bibliography style (24-Jan-88 version)
  2. %    A lot like abbrv.bst, but names come out "Last, initials", and in \sc.
  3. %    Some dates are parenthesized.
  4. %
  5. %    History
  6. %     2/ 6/86    (HWT)    Original version, by Howard Trickey.
  7. %     3/ 5/86    (HWT)    Put in pp. everywhere but articles, as per ACM style.
  8. %     1/24/88    (OP&HWT) Updated for BibTeX version 0.99a, Oren Patashnik;
  9. %            corrected the abbreviations to "Mar." and "Sept.";
  10. %            THIS `acm' VERSION DOES NOT WORK WITH BIBTEX 0.98i.
  11.  
  12. ENTRY
  13.   { address
  14.     author
  15.     booktitle
  16.     chapter
  17.     edition
  18.     editor
  19.     howpublished
  20.     institution
  21.     journal
  22.     key
  23.     month
  24.     note
  25.     number
  26.     organization
  27.     pages
  28.     publisher
  29.     school
  30.     series
  31.     title
  32.     type
  33.     volume
  34.     year
  35.   }
  36.   {}
  37.   { label }
  38.  
  39. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  40.  
  41. FUNCTION {init.state.consts}
  42. { #0 'before.all :=
  43.   #1 'mid.sentence :=
  44.   #2 'after.sentence :=
  45.   #3 'after.block :=
  46. }
  47.  
  48. STRINGS { s t }
  49.  
  50. FUNCTION {output.nonnull}
  51. { 's :=
  52.   output.state mid.sentence =
  53.     { ", " * write$ }
  54.     { output.state after.block =
  55.     { add.period$ write$
  56.       newline$
  57.       "\newblock " write$
  58.     }
  59.     { output.state before.all =
  60.         'write$
  61.         { add.period$ " " * write$ }
  62.       if$
  63.     }
  64.       if$
  65.       mid.sentence 'output.state :=
  66.     }
  67.   if$
  68.   s
  69. }
  70.  
  71. FUNCTION {output}
  72. { duplicate$ empty$
  73.     'pop$
  74.     'output.nonnull
  75.   if$
  76. }
  77.  
  78. FUNCTION {output.check}
  79. { 't :=
  80.   duplicate$ empty$
  81.     { pop$ "empty " t * " in " * cite$ * warning$ }
  82.     'output.nonnull
  83.   if$
  84. }
  85.  
  86. FUNCTION {output.bibitem}
  87. { newline$
  88.   "\bibitem{" write$
  89.   cite$ write$
  90.   "}" write$
  91.   newline$
  92.   ""
  93.   before.all 'output.state :=
  94. }
  95.  
  96. FUNCTION {fin.entry}
  97. { add.period$
  98.   write$
  99.   newline$
  100. }
  101.  
  102. FUNCTION {new.block}
  103. { output.state before.all =
  104.     'skip$
  105.     { after.block 'output.state := }
  106.   if$
  107. }
  108.  
  109. FUNCTION {new.sentence}
  110. { output.state after.block =
  111.     'skip$
  112.     { output.state before.all =
  113.     'skip$
  114.     { after.sentence 'output.state := }
  115.       if$
  116.     }
  117.   if$
  118. }
  119.  
  120. FUNCTION {not}
  121. {   { #0 }
  122.     { #1 }
  123.   if$
  124. }
  125.  
  126. FUNCTION {and}
  127. {   'skip$
  128.     { pop$ #0 }
  129.   if$
  130. }
  131.  
  132. FUNCTION {or}
  133. {   { pop$ #1 }
  134.     'skip$
  135.   if$
  136. }
  137.  
  138. FUNCTION {new.block.checka}
  139. { empty$
  140.     'skip$
  141.     'new.block
  142.   if$
  143. }
  144.  
  145. FUNCTION {new.block.checkb}
  146. { empty$
  147.   swap$ empty$
  148.   and
  149.     'skip$
  150.     'new.block
  151.   if$
  152. }
  153.  
  154. FUNCTION {field.or.null}
  155. { duplicate$ empty$
  156.     { pop$ "" }
  157.     'skip$
  158.   if$
  159. }
  160.  
  161. FUNCTION {emphasize}
  162. { duplicate$ empty$
  163.     { pop$ "" }
  164.     { "{\em " swap$ * "}" * }
  165.   if$
  166. }
  167.  
  168. FUNCTION {emphasizeic}
  169. { duplicate$ empty$
  170.     { pop$ "" }
  171.     { "{\em " swap$ * "\/}" * }
  172.   if$
  173. }
  174.  
  175. FUNCTION {scapify}
  176. { duplicate$ empty$
  177.     { pop$ "" }
  178.     { "{\sc " swap$ * "}" * }
  179.   if$
  180. }
  181.  
  182. INTEGERS { nameptr namesleft numnames }
  183.  
  184. FUNCTION {format.names}
  185. { 's :=
  186.   #1 'nameptr :=
  187.   s num.names$ 'numnames :=
  188.   numnames 'namesleft :=
  189.     { namesleft #0 > }
  190.     { s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't :=
  191.       nameptr #1 >
  192.     { namesleft #1 >
  193.         { ", " * t * }
  194.         { t "others" =
  195.         { ", et~al." * }
  196.         { ", and " * t * }
  197.           if$
  198.         }
  199.       if$
  200.     }
  201.     't
  202.       if$
  203.       nameptr #1 + 'nameptr :=
  204.       namesleft #1 - 'namesleft :=
  205.     }
  206.   while$
  207. }
  208.  
  209. % For names inside entries (e.g., editors of an "In ...");
  210. % this is exactly ABBRV.BST's `format.names' function.
  211. FUNCTION {format.innames}
  212. { 's :=
  213.   #1 'nameptr :=
  214.   s num.names$ 'numnames :=
  215.   numnames 'namesleft :=
  216.     { namesleft #0 > }
  217.     { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=
  218.       nameptr #1 >
  219.     { namesleft #1 >
  220.         { ", " * t * }
  221.         { numnames #2 >
  222.         { "," * }
  223.         'skip$
  224.           if$
  225.           t "others" =
  226.         { " et~al." * }
  227.         { " and " * t * }
  228.           if$
  229.         }
  230.       if$
  231.     }
  232.     't
  233.       if$
  234.       nameptr #1 + 'nameptr :=
  235.       namesleft #1 - 'namesleft :=
  236.     }
  237.   while$
  238. }
  239.  
  240. FUNCTION {format.authors}
  241. { author empty$
  242.     { "" }
  243.     { author format.names scapify }
  244.   if$
  245. }
  246.  
  247. FUNCTION {format.editors}
  248. { editor empty$
  249.     { "" }
  250.     { editor format.names scapify
  251.       editor num.names$ #1 >
  252.     { ", Eds." * }
  253.     { ", Ed." * }
  254.       if$
  255.     }
  256.   if$
  257. }
  258.  
  259. FUNCTION {format.ineditors}
  260. { editor empty$
  261.     { "" }
  262.     { editor format.innames
  263.       editor num.names$ #1 >
  264.     { ", Eds." * }
  265.     { ", Ed." * }
  266.       if$
  267.     }
  268.   if$
  269. }
  270.  
  271. FUNCTION {format.title}
  272. { title empty$
  273.     { "" }
  274.     { title "t" change.case$ }
  275.   if$
  276. }
  277.  
  278. FUNCTION {n.dashify}
  279. { 't :=
  280.   ""
  281.     { t empty$ not }
  282.     { t #1 #1 substring$ "-" =
  283.     { t #1 #2 substring$ "--" = not
  284.         { "--" *
  285.           t #2 global.max$ substring$ 't :=
  286.         }
  287.         {   { t #1 #1 substring$ "-" = }
  288.         { "-" *
  289.           t #2 global.max$ substring$ 't :=
  290.         }
  291.           while$
  292.         }
  293.       if$
  294.     }
  295.     { t #1 #1 substring$ *
  296.       t #2 global.max$ substring$ 't :=
  297.     }
  298.       if$
  299.     }
  300.   while$
  301. }
  302.  
  303. FUNCTION {format.date}
  304. { year empty$
  305.     { month empty$
  306.     { "" }
  307.     { "there's a month but no year in " cite$ * warning$
  308.       month
  309.     }
  310.       if$
  311.     }
  312.     { month empty$
  313.     'year
  314.     { month " " * year * }
  315.       if$
  316.     }
  317.   if$
  318. }
  319.  
  320. FUNCTION {format.btitle}
  321. { title emphasize
  322. }
  323.  
  324. FUNCTION {tie.or.space.connect}
  325. { duplicate$ text.length$ #3 <
  326.     { "~" }
  327.     { " " }
  328.   if$
  329.   swap$ * *
  330. }
  331.  
  332. FUNCTION {either.or.check}
  333. { empty$
  334.     'pop$
  335.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  336.   if$
  337. }
  338.  
  339. FUNCTION {format.bvolume}
  340. { volume empty$
  341.     { "" }
  342.     { "vol.~" volume *
  343.       series empty$
  344.     'skip$
  345.     { " of " * series emphasize * }
  346.       if$
  347.       "volume and number" number either.or.check
  348.     }
  349.   if$
  350. }
  351.  
  352. FUNCTION {format.number.series}
  353. { volume empty$
  354.     { number empty$
  355.     { series field.or.null }
  356.     { output.state mid.sentence =
  357.         { "no.~" }
  358.         { "No.~" }
  359.       if$
  360.       number *
  361.       series empty$
  362.         { "there's a number but no series in " cite$ * warning$ }
  363.         { " in " * series * }
  364.       if$
  365.     }
  366.       if$
  367.     }
  368.     { "" }
  369.   if$
  370. }
  371.  
  372. FUNCTION {format.edition}
  373. { edition empty$
  374.     { "" }
  375.     { output.state mid.sentence =
  376.     { edition "l" change.case$ "~ed." * }
  377.     { edition "t" change.case$ "~ed." * }
  378.       if$
  379.     }
  380.   if$
  381. }
  382.  
  383. FUNCTION {format.pages}
  384. { pages empty$
  385.     { "" }
  386.     { pages n.dashify }
  387.   if$
  388. }
  389.  
  390. INTEGERS { multiresult }
  391.  
  392. FUNCTION {multi.page.check}
  393. { 't :=
  394.   #0 'multiresult :=
  395.     { multiresult not
  396.       t empty$ not
  397.       and
  398.     }
  399.     { t #1 #1 substring$
  400.       duplicate$ "-" =
  401.       swap$ duplicate$ "," =
  402.       swap$ "+" =
  403.       or or
  404.     { #1 'multiresult := }
  405.     { t #2 global.max$ substring$ 't := }
  406.       if$
  407.     }
  408.   while$
  409.   multiresult
  410. }
  411.  
  412. FUNCTION {format.pp.pages}
  413. { pages empty$
  414.     { "" }
  415.     { pages multi.page.check
  416.     { "pp.~" pages n.dashify * }
  417.     { "p.~" pages * }
  418.       if$
  419.     }
  420.   if$
  421. }
  422.  
  423. FUNCTION {format.journal.vol.num.date}
  424. { journal empty$
  425.     { "empty journal in " cite$ * warning$
  426.       ""
  427.     }
  428.     { journal
  429.       volume empty$
  430.     'skip$
  431.     { " " * volume * }
  432.       if$
  433.       number empty$
  434.     'emphasizeic
  435.     { emphasize ", " * number * }
  436.       if$
  437.       year empty$
  438.     { "empty year in " cite$ * warning$ }
  439.     { " (" * format.date * ")" * }
  440.       if$
  441.     }
  442.   if$
  443. }
  444.  
  445. FUNCTION {format.chapter.pages}
  446. { chapter empty$
  447.     'format.pp.pages
  448.     { type empty$
  449.     { "ch.~" chapter * }
  450.     { type "l" change.case$ chapter tie.or.space.connect }
  451.       if$
  452.       pages empty$
  453.     'skip$
  454.     { ", " * format.pp.pages * }
  455.       if$
  456.     }
  457.   if$
  458. }
  459.  
  460. FUNCTION {format.in.ed.booktitle}
  461. { booktitle empty$
  462.     { "" }
  463.     { "In " booktitle emphasize *
  464.       editor empty$
  465.     'skip$
  466.     { ", " * format.ineditors * }
  467.       if$
  468.     }
  469.   if$
  470. }
  471.  
  472. % The proceedings title (it's on the stack) gets an (address, date) appended
  473. FUNCTION {format.proc.date}
  474. { duplicate$ empty$
  475.     { pop$ "" }
  476.     { year empty$
  477.     { "empty year in " cite$ * warning$
  478.       address empty$
  479.         'emphasize
  480.         { emphasizeic
  481.           " (" * address * ")" *
  482.         }
  483.       if$
  484.     }
  485.     { emphasizeic
  486.       " (" *
  487.       address empty$
  488.         'skip$
  489.         { address * ", " * }
  490.       if$
  491.       format.date *
  492.       ")" *
  493.     }
  494.       if$
  495.     }
  496.   if$
  497. }
  498.  
  499. FUNCTION {format.in.proc.date}
  500. { booktitle empty$
  501.     { "" }
  502.     { "In " booktitle format.proc.date * }
  503.   if$
  504. }
  505.  
  506. FUNCTION {empty.misc.check}
  507. { author empty$ title empty$ howpublished empty$
  508.   month empty$ year empty$ note empty$
  509.   and and and and and
  510.   key empty$ not and
  511.     { "all relevant fields are empty in " cite$ * warning$ }
  512.     'skip$
  513.   if$
  514. }
  515.  
  516. FUNCTION {format.thesis.type}
  517. { type empty$
  518.     'skip$
  519.     { pop$
  520.       type "t" change.case$
  521.     }
  522.   if$
  523. }
  524.  
  525. FUNCTION {format.tr.number}
  526. { type empty$
  527.     { "Tech. Rep." }
  528.     'type
  529.   if$
  530.   number empty$
  531.     { "t" change.case$ }
  532.     { number tie.or.space.connect }
  533.   if$
  534. }
  535.  
  536. FUNCTION {format.article.crossref}
  537. { key empty$
  538.     { journal empty$
  539.     { "need key or journal for " cite$ * " to crossref " * crossref *
  540.       warning$
  541.       ""
  542.     }
  543.     { "In {\em " journal * "\/}" * }
  544.       if$
  545.     }
  546.     { "In " key * }
  547.   if$
  548.   " \cite{" * crossref * "}" *
  549. }
  550.  
  551. FUNCTION {format.crossref.editor}
  552. { editor #1 "{vv~}{ll}" format.name$
  553.   editor num.names$ duplicate$
  554.   #2 >
  555.     { pop$ " et~al." * }
  556.     { #2 <
  557.     'skip$
  558.     { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  559.         { " et~al." * }
  560.         { " and " * editor #2 "{vv~}{ll}" format.name$ * }
  561.       if$
  562.     }
  563.       if$
  564.     }
  565.   if$
  566. }
  567.  
  568. FUNCTION {format.book.crossref}
  569. { volume empty$
  570.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  571.       "In "
  572.     }
  573.     { "Vol.~" volume *
  574.       " of " *
  575.     }
  576.   if$
  577.   editor empty$
  578.   editor field.or.null author field.or.null =
  579.   or
  580.     { key empty$
  581.     { series empty$
  582.         { "need editor, key, or series for " cite$ * " to crossref " *
  583.           crossref * warning$
  584.           "" *
  585.         }
  586.         { "{\em " * series * "\/}" * }
  587.       if$
  588.     }
  589.     { key * }
  590.       if$
  591.     }
  592.     { format.crossref.editor * }
  593.   if$
  594.   " \cite{" * crossref * "}" *
  595. }
  596.  
  597. FUNCTION {format.incoll.inproc.crossref}
  598. { editor empty$
  599.   editor field.or.null author field.or.null =
  600.   or
  601.     { key empty$
  602.     { booktitle empty$
  603.         { "need editor, key, or booktitle for " cite$ * " to crossref " *
  604.           crossref * warning$
  605.           ""
  606.         }
  607.         { "In {\em " booktitle * "\/}" * }
  608.       if$
  609.     }
  610.     { "In " key * }
  611.       if$
  612.     }
  613.     { "In " format.crossref.editor * }
  614.   if$
  615.   " \cite{" * crossref * "}" *
  616. }
  617.  
  618. FUNCTION {article}
  619. { output.bibitem
  620.   format.authors "author" output.check
  621.   new.block
  622.   format.title "title" output.check
  623.   new.block
  624.   crossref missing$
  625.     { format.journal.vol.num.date output
  626.       format.pages output
  627.     }
  628.     { format.article.crossref output.nonnull
  629.       format.pp.pages output
  630.     }
  631.   if$
  632.   new.block
  633.   note output
  634.   fin.entry
  635. }
  636.  
  637. FUNCTION {book}
  638. { output.bibitem
  639.   author empty$
  640.     { format.editors "author and editor" output.check }
  641.     { format.authors output.nonnull
  642.       crossref missing$
  643.     { "author and editor" editor either.or.check }
  644.     'skip$
  645.       if$
  646.     }
  647.   if$
  648.   new.block
  649.   format.btitle "title" output.check
  650.   format.edition output
  651.   crossref missing$
  652.     { format.bvolume output
  653.       new.block
  654.       format.number.series output
  655.       new.sentence
  656.       publisher "publisher" output.check
  657.       address output
  658.     }
  659.     { new.block
  660.       format.book.crossref output.nonnull
  661.     }
  662.   if$
  663.   format.date "year" output.check
  664.   new.block
  665.   note output
  666.   fin.entry
  667. }
  668.  
  669. FUNCTION {booklet}
  670. { output.bibitem
  671.   format.authors output
  672.   new.block
  673.   format.title "title" output.check
  674.   howpublished address new.block.checkb
  675.   howpublished output
  676.   address output
  677.   format.date output
  678.   new.block
  679.   note output
  680.   fin.entry
  681. }
  682.  
  683. FUNCTION {inbook}
  684. { output.bibitem
  685.   author empty$
  686.     { format.editors "author and editor" output.check }
  687.     { format.authors output.nonnull
  688.       crossref missing$
  689.     { "author and editor" editor either.or.check }
  690.     'skip$
  691.       if$
  692.     }
  693.   if$
  694.   new.block
  695.   format.btitle "title" output.check
  696.   format.edition output
  697.   crossref missing$
  698.     { format.bvolume output
  699.       new.block
  700.       format.number.series output
  701.       new.sentence
  702.       publisher "publisher" output.check
  703.       address output
  704.     }
  705.     { new.block
  706.       format.book.crossref output.nonnull
  707.     }
  708.   if$
  709.   format.date "year" output.check
  710.   format.chapter.pages "chapter and pages" output.check
  711.   new.block
  712.   note output
  713.   fin.entry
  714. }
  715.  
  716. FUNCTION {incollection}
  717. { output.bibitem
  718.   format.authors "author" output.check
  719.   new.block
  720.   format.title "title" output.check
  721.   new.block
  722.   crossref missing$
  723.     { format.in.ed.booktitle "booktitle" output.check
  724.       format.edition output
  725.       format.bvolume output
  726.       format.number.series output
  727.       new.sentence
  728.       publisher "publisher" output.check
  729.       address output
  730.       format.date "year" output.check
  731.     }
  732.     { format.incoll.inproc.crossref output.nonnull }
  733.   if$
  734.   format.chapter.pages output
  735.   new.block
  736.   note output
  737.   fin.entry
  738. }
  739.  
  740. FUNCTION {inproceedings}
  741. { output.bibitem
  742.   format.authors "author" output.check
  743.   new.block
  744.   format.title "title" output.check
  745.   new.block
  746.   crossref missing$
  747.     { format.in.proc.date "booktitle" output.check
  748.       format.ineditors output
  749.       format.bvolume output
  750.       format.number.series output
  751.       organization output
  752.       publisher output
  753.     }
  754.     { format.incoll.inproc.crossref output.nonnull }
  755.   if$
  756.   format.pp.pages output
  757.   new.block
  758.   note output
  759.   fin.entry
  760. }
  761.  
  762. FUNCTION {conference} { inproceedings }
  763.  
  764. FUNCTION {manual}
  765. { output.bibitem
  766.   author empty$
  767.     { organization scapify output }
  768.     { format.authors output.nonnull }
  769.   if$
  770.   new.block
  771.   format.btitle "title" output.check
  772.   format.edition output
  773.   author empty$
  774.     { address new.block.checka }
  775.     { organization address new.block.checkb
  776.       organization output
  777.     }
  778.   if$
  779.   address output
  780.   format.date output
  781.   new.block
  782.   note output
  783.   fin.entry
  784. }
  785.  
  786. FUNCTION {mastersthesis}
  787. { output.bibitem
  788.   format.authors "author" output.check
  789.   new.block
  790.   format.title "title" output.check
  791.   new.block
  792.   "Master's thesis" format.thesis.type output.nonnull
  793.   school "school" output.check
  794.   address output
  795.   format.date "year" output.check
  796.   new.block
  797.   note output
  798.   fin.entry
  799. }
  800.  
  801. FUNCTION {misc}
  802. { output.bibitem
  803.   format.authors output
  804.   title howpublished new.block.checkb
  805.   format.title output
  806.   howpublished new.block.checka
  807.   howpublished output
  808.   format.date output
  809.   new.block
  810.   note output
  811.   fin.entry
  812.   empty.misc.check
  813. }
  814.  
  815. FUNCTION {phdthesis}
  816. { output.bibitem
  817.   format.authors "author" output.check
  818.   new.block
  819.   format.btitle "title" output.check
  820.   new.block
  821.   "PhD thesis" format.thesis.type output.nonnull
  822.   school "school" output.check
  823.   address output
  824.   format.date "year" output.check
  825.   new.block
  826.   note output
  827.   fin.entry
  828. }
  829.  
  830. FUNCTION {proceedings}
  831. { output.bibitem
  832.   editor empty$
  833.     { organization scapify output }
  834.     { format.editors output.nonnull }
  835.   if$
  836.   new.block
  837.   title format.proc.date "title" output.check
  838.   format.bvolume output
  839.   format.number.series output
  840.   editor empty$
  841.     'skip$
  842.     { organization output }
  843.   if$
  844.   publisher output
  845.   new.block
  846.   note output
  847.   fin.entry
  848. }
  849.  
  850. FUNCTION {techreport}
  851. { output.bibitem
  852.   format.authors "author" output.check
  853.   new.block
  854.   format.title "title" output.check
  855.   new.block
  856.   format.tr.number output.nonnull
  857.   institution "institution" output.check
  858.   address output
  859.   format.date "year" output.check
  860.   new.block
  861.   note output
  862.   fin.entry
  863. }
  864.  
  865. FUNCTION {unpublished}
  866. { output.bibitem
  867.   format.authors "author" output.check
  868.   new.block
  869.   format.title "title" output.check
  870.   new.block
  871.   note "note" output.check
  872.   format.date output
  873.   fin.entry
  874. }
  875.  
  876. FUNCTION {default.type} { misc }
  877.  
  878. MACRO {jan} {"Jan."}
  879.  
  880. MACRO {feb} {"Feb."}
  881.  
  882. MACRO {mar} {"Mar."}
  883.  
  884. MACRO {apr} {"Apr."}
  885.  
  886. MACRO {may} {"May"}
  887.  
  888. MACRO {jun} {"June"}
  889.  
  890. MACRO {jul} {"July"}
  891.  
  892. MACRO {aug} {"Aug."}
  893.  
  894. MACRO {sep} {"Sept."}
  895.  
  896. MACRO {oct} {"Oct."}
  897.  
  898. MACRO {nov} {"Nov."}
  899.  
  900. MACRO {dec} {"Dec."}
  901.  
  902. MACRO {acmcs} {"ACM Comput. Surv."}
  903.  
  904. MACRO {acta} {"Acta Inf."}
  905.  
  906. MACRO {cacm} {"Commun. ACM"}
  907.  
  908. MACRO {ibmjrd} {"IBM J. Res. Dev."}
  909.  
  910. MACRO {ibmsj} {"IBM Syst.~J."}
  911.  
  912. MACRO {ieeese} {"IEEE Trans. Softw. Eng."}
  913.  
  914. MACRO {ieeetc} {"IEEE Trans. Comput."}
  915.  
  916. MACRO {ieeetcad}
  917.  {"IEEE Trans. Comput.-Aided Design Integrated Circuits"}
  918.  
  919. MACRO {ipl} {"Inf. Process. Lett."}
  920.  
  921. MACRO {jacm} {"J.~ACM"}
  922.  
  923. MACRO {jcss} {"J.~Comput. Syst. Sci."}
  924.  
  925. MACRO {scp} {"Sci. Comput. Programming"}
  926.  
  927. MACRO {sicomp} {"SIAM J. Comput."}
  928.  
  929. MACRO {tocs} {"ACM Trans. Comput. Syst."}
  930.  
  931. MACRO {tods} {"ACM Trans. Database Syst."}
  932.  
  933. MACRO {tog} {"ACM Trans. Gr."}
  934.  
  935. MACRO {toms} {"ACM Trans. Math. Softw."}
  936.  
  937. MACRO {toois} {"ACM Trans. Office Inf. Syst."}
  938.  
  939. MACRO {toplas} {"ACM Trans. Program. Lang. Syst."}
  940.  
  941. MACRO {tcs} {"Theoretical Comput. Sci."}
  942.  
  943. READ
  944.  
  945. FUNCTION {sortify}
  946. { purify$
  947.   "l" change.case$
  948. }
  949.  
  950. INTEGERS { len }
  951.  
  952. FUNCTION {chop.word}
  953. { 's :=
  954.   'len :=
  955.   s #1 len substring$ =
  956.     { s len #1 + global.max$ substring$ }
  957.     's
  958.   if$
  959. }
  960.  
  961. FUNCTION {sort.format.names}
  962. { 's :=
  963.   #1 'nameptr :=
  964.   ""
  965.   s num.names$ 'numnames :=
  966.   numnames 'namesleft :=
  967.     { namesleft #0 > }
  968.     { nameptr #1 >
  969.     { "   " * }
  970.     'skip$
  971.       if$
  972.       s nameptr "{vv{ } }{ll{ }}{  f{ }}{  jj{ }}" format.name$ 't :=
  973.       nameptr numnames = t "others" = and
  974.     { "et al" * }
  975.     { t sortify * }
  976.       if$
  977.       nameptr #1 + 'nameptr :=
  978.       namesleft #1 - 'namesleft :=
  979.     }
  980.   while$
  981. }
  982.  
  983. FUNCTION {sort.format.title}
  984. { 't :=
  985.   "A " #2
  986.     "An " #3
  987.       "The " #4 t chop.word
  988.     chop.word
  989.   chop.word
  990.   sortify
  991.   #1 global.max$ substring$
  992. }
  993.  
  994. FUNCTION {author.sort}
  995. { author empty$
  996.     { key empty$
  997.     { "to sort, need author or key in " cite$ * warning$
  998.       ""
  999.     }
  1000.     { key sortify }
  1001.       if$
  1002.     }
  1003.     { author sort.format.names }
  1004.   if$
  1005. }
  1006.  
  1007. FUNCTION {author.editor.sort}
  1008. { author empty$
  1009.     { editor empty$
  1010.     { key empty$
  1011.         { "to sort, need author, editor, or key in " cite$ * warning$
  1012.           ""
  1013.         }
  1014.         { key sortify }
  1015.       if$
  1016.     }
  1017.     { editor sort.format.names }
  1018.       if$
  1019.     }
  1020.     { author sort.format.names }
  1021.   if$
  1022. }
  1023.  
  1024. FUNCTION {author.organization.sort}
  1025. { author empty$
  1026.     { organization empty$
  1027.     { key empty$
  1028.         { "to sort, need author, organization, or key in " cite$ * warning$
  1029.           ""
  1030.         }
  1031.         { key sortify }
  1032.       if$
  1033.     }
  1034.     { "The " #4 organization chop.word sortify }
  1035.       if$
  1036.     }
  1037.     { author sort.format.names }
  1038.   if$
  1039. }
  1040.  
  1041. FUNCTION {editor.organization.sort}
  1042. { editor empty$
  1043.     { organization empty$
  1044.     { key empty$
  1045.         { "to sort, need editor, organization, or key in " cite$ * warning$
  1046.           ""
  1047.         }
  1048.         { key sortify }
  1049.       if$
  1050.     }
  1051.     { "The " #4 organization chop.word sortify }
  1052.       if$
  1053.     }
  1054.     { editor sort.format.names }
  1055.   if$
  1056. }
  1057.  
  1058. FUNCTION {presort}
  1059. { type$ "book" =
  1060.   type$ "inbook" =
  1061.   or
  1062.     'author.editor.sort
  1063.     { type$ "proceedings" =
  1064.     'editor.organization.sort
  1065.     { type$ "manual" =
  1066.         'author.organization.sort
  1067.         'author.sort
  1068.       if$
  1069.     }
  1070.       if$
  1071.     }
  1072.   if$
  1073.   "    "
  1074.   *
  1075.   year field.or.null sortify
  1076.   *
  1077.   "    "
  1078.   *
  1079.   title field.or.null
  1080.   sort.format.title
  1081.   *
  1082.   #1 entry.max$ substring$
  1083.   'sort.key$ :=
  1084. }
  1085.  
  1086. ITERATE {presort}
  1087.  
  1088. SORT
  1089.  
  1090. STRINGS { longest.label }
  1091.  
  1092. INTEGERS { number.label longest.label.width }
  1093.  
  1094. FUNCTION {initialize.longest.label}
  1095. { "" 'longest.label :=
  1096.   #1 'number.label :=
  1097.   #0 'longest.label.width :=
  1098. }
  1099.  
  1100. FUNCTION {longest.label.pass}
  1101. { number.label int.to.str$ 'label :=
  1102.   number.label #1 + 'number.label :=
  1103.   label width$ longest.label.width >
  1104.     { label 'longest.label :=
  1105.       label width$ 'longest.label.width :=
  1106.     }
  1107.     'skip$
  1108.   if$
  1109. }
  1110.  
  1111. EXECUTE {initialize.longest.label}
  1112.  
  1113. ITERATE {longest.label.pass}
  1114.  
  1115. FUNCTION {begin.bib}
  1116. { preamble$ empty$
  1117.     'skip$
  1118.     { preamble$ write$ newline$ }
  1119.   if$
  1120.   "\begin{thebibliography}{"  longest.label  * "}" * write$ newline$
  1121. }
  1122.  
  1123. EXECUTE {begin.bib}
  1124.  
  1125. EXECUTE {init.state.consts}
  1126.  
  1127. ITERATE {call.type$}
  1128.  
  1129. FUNCTION {end.bib}
  1130. { newline$
  1131.   "\end{thebibliography}" write$ newline$
  1132. }
  1133.  
  1134. EXECUTE {end.bib}
  1135.